import request from '../utils/request'
//提取.env文件中的VITE_BASE
let base = import.meta.env.VITE_BASE
console.log('读取的.env配置',base);
export const userReg = (user)=>{ //注册
  return request.post(`${base}/users`,user)
}

export const userLogin = (user)=>{ //登录
  return request.get(`${base}/users`,{
    params:user
  })
}

export const userCartAdd = (cartObj)=>{ //加入购物车
  return request.post(`${base}/cart`,cartObj)
}

export const userCartGet = (userid)=>{ //初始化购物车
  return request.get(`${base}/cart?userid=${userid}`)
}

export const userCartUpdate = (cartid,cartObj)=>{ //加入购物车
  return request.put(`${base}/cart${cartid}`,cartObj)
}